<?php
$this->headScript()
    ->appendFile($this->APP_STATIC_SERVER.'/js/jquery.cycle/jquery.cycle.all.min.js');
?>
<style>
    .cycle_nav a:hover, a:active{
        text-decoration:none;
    }
    .cycle_nav a{
        text-decoration:none;
    }
</style>
<div class="caption_box icon_title" style="background:none repeat scroll 0 0 #BBCD00;">
    <div style="float:left; width:50%">
        <span style="color:#FFF;"><?php echo $this->translator()->widget('widget_special_product');?></span>
    </div>
    <div style="float:right; width:50%;" class="cycle_nav">
        <div style="text-align:right; padding-right:5px; margin-top:-3px; font-size:20px;">
            <a id="ad_prev" href="#" style="color:#fff;font-size:9pt;">◄</a>&nbsp;<a id="ad_next" href="#" style="color:#fff;font-size:9pt;">►</a>
        </div>
    </div>
</div>
<div id="wid_advertise">
    <?php $i=0; foreach ($this->products as $product):?>
    <?php    
        //Category follow product
        $objCategory = $this->arrPC[$product->product_id];

        //Enterprise follow product        
        $objEnterprise = $this->arrPE[$product->product_id];

        //Param url detail
        $arrRouteDetail = array(
            'enterprise_id' => $objEnterprise->id,
            'enterprise_name' => Tomato_Utility_String::removeSign($objEnterprise->company_name_en, '-', true),
            'cat' => $objCategory->category_id,
            'slug' => ($objCategory->slug)?$objCategory->slug:Tomato_Utility_String::removeSign($objCategory->category_admin_name, '-', true),
            'product_id' => $product->product_id,
            'pro_slug' => ($product->slug)?$product->slug:Tomato_Utility_String::removeSign($product->product_admin_name, '-', true),
        );

        $p_name = ($product->product_content_name)?$product->product_content_name:$product->product_admin_name;       
    ?>
    <?php if($i%4==0):?>
    <div class="subrow" style="float:left;">
    <?php endif;?>
        <div style="float:left; width:24%; padding-right:5px;">
            <div class="subcolumns_oldgecko" style="padding: 0 3px">
                <div style="height:165px; width:160px; overflow:hidden; margin-bottom:5px; display: table-cell; vertical-align:middle;">
                    <?php if($product->getImage()):?>
			        <a href="<?php echo $this->url($arrRouteDetail,'shop_product_detail');?>">
			            <img width="160" src="<?php echo $product->getImage('_small', 200);?>" class="item_img" alt="<?php echo $p_name;?>">
			        </a>
	        		<?php endif;?>
                </div>
                <div class="subcolumns_oldgecko">
                    <a href="<?php echo $this->url($arrRouteDetail,'shop_product_detail');?>" title="<?php echo $p_name;?>"><span class="title" style="font-size:9px;"><?php echo strip_tags(Tomato_Helper_Helper::substring($p_name,20));?></span></a>
                </div>                
            </div>
        </div>
    <?php $i++; if($i%4==0):?>
    </div>
    <?php endif;?>
    <?php endforeach;?>
    <?php if($i%4!=0):?>
    </div>
    <?php endif;?>
</div>
<script type="text/javascript">
$(document).ready(function() {
    $('#wid_advertise').cycle({
        fx:     'scrollHorz',
        timeout: 0,
        delay:  2000,
        next:   '#ad_next',
        prev:   '#ad_prev',
    });
});
</script>